<template>
  <view class="notice-detail">
    <view class="title">{{ notice.noticeTitle }}</view>
    <view class="meta">
      类型：{{ getNoticeTypeLabel(notice.noticeType) }} |
      状态：{{ notice.status === '0' ? '正常' : '关闭' }}
    </view>
    <view class="content" v-html="notice.noticeContent"></view>
  </view>
</template>

<script>
import { getNotice } from '@/api/system/notice';

export default {
  data() {
    return {
      notice: {}
    };
  },
  onLoad(options) {
    if (options.noticeId) {
      this.getNoticeDetail(options.noticeId);
    }
  },
  methods: {
    async getNoticeDetail(noticeId) {
        getNotice(noticeId).then(res => {
		  this.notice = res.data;
		})
    },
    getNoticeTypeLabel(type) {
      return type === '1' ? '通知' : '公告';
    }
  }
};
</script>

<style scoped>
.notice-detail {
  padding: 40rpx;
}
.title {
  font-size: 36rpx;
  font-weight: bold;
  margin-bottom: 20rpx;
}
.meta {
  color: #888;
  margin-bottom: 30rpx;
}
.content {
  font-size: 28rpx;
  line-height: 48rpx;
}
</style>